home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4821 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Beginner: How to #include
  5. Date: Thu, 01 Feb 1996 04:27:42 GMT
  6. Organization: Netcom
  7. Message-ID: <3110405d.31483776@nntp.ix.netcom.com>
  8. References: <west.32.008AC8C0@emt.e-technik.tu-muenchen.de> <00001a81+0000973a@msn.com>
  9. NNTP-Posting-Host: ix-dc11-20.ix.netcom.com
  10. X-NETCOM-Date: Wed Jan 31  8:28:11 PM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. Tendrils@msn.com (kelvin  ) wrote:
  14.  
  15. > Generally, it is best to put #includes in .cpp files
  16. > my_data.h:
  17. > ----------
  18. > class CPicture; // forward declaration
  19. > class A
  20. > {
  21. > ..
  22. > CPicture m_picture;
  23. > ...
  24. > }
  25. > my_program.cpp:
  26. > ---------------
  27. > #include "my_data.h"
  28. > Also,
  29. > it is a very good practice to put the following two statements
  30. > at the top of the .h file
  31. > #ifndef _MY_DATA_H_
  32. > #define _MY_DATA_H_
  33. > and the following statement at the last line of the .h file
  34. > #endif
  35.  
  36. It's better practice to use something like
  37.  
  38.     #ifndef MY_DATA_H_
  39.     #define MY_DATA_H_
  40.     // ...
  41.     #endif
  42.  
  43. _MY_DATA_H_ is a reserveed identifier, as are all identifiers
  44. beginning with an underscore and an uppercase letter (draft 2.9).
  45.  
  46.  
  47. Michael M Rubenstein
  48.